#pragma once
class CppMySQL3DB;
class CDB;
typedef void (CDB::*FORMATFUN)(void* pFunc, void* pData);
class CDB
{
public:
	CDB(void);
	int ConnectDB(const char* szIp,const char* szDBName);
	int ExecSQL(const char* sql);
	int QuerySQL(const char* sql,DWORD dwSize, FORMATFUN func,DWORD& nNums, void* lpData);


	void FormatUserInformation(void* q, void* lpData);
	DWORD LoadUserInformation(void* lpData);

	void FormatRoleInfor(void* q, void* lpData);
	DWORD LoadRoleInfor(void* &lpData, DWORD& dwSize);

	DWORD PlayerAuthSession(void* lpData);
	~CDB(void);
private:
	CppMySQL3DB* m_pDB;
	char* m_pBuff;
};

extern CDB sDB;